package com.msw.dubbo.service;

import com.msw.dubbo.entity.Order;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.annotation.Method;

import java.util.Date;
import java.util.List;

/**
 * @author mashuangwei
 * @version 1.0.0
 * @date 2022-06-07 21:07:50
 */
// 控制一个服务下所有方法
//@DubboService(timeout = 2000,retries = 3)
// 控制一个服务某些方法(方法可以指定控制多个)
//@DubboService(methods = {@Method(name = "方法名",timeout = 2000,retries = 3)})
@DubboService
public class OrderServiceImpl implements OrderService {
    @Override
    public String addOrder(){
        return "order: " + new Date().toString();
    }

    @Override
    public Order updateOrder(Order order) {
        return order;
    }

    @Override
    public List<Order> batchOrders(List<Order> orders) {
        System.err.println("batchOrders: " + orders);
        return orders;
    }

}
